﻿<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> <%@ Page Language="C#" Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" MasterPageFile="~/_layouts/application.master"      %> <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="psw" Namespace="PhilWicklund.com.SiteCreationWorkflow.Data" Assembly="PhilWicklund.com.SiteCreationWorkflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0c581f3907d72045" %> 

<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="PhilWicklund.com.SiteCreationWorkflow.Data" %>


<asp:Content ID="Content1" contentplaceholderid="PlaceHolderPageTitle" runat="server">
	Site Creation Workflow settings
</asp:Content>
<asp:Content ID="Content2" contentplaceholderid="PlaceHolderPageTitleInTitleArea" runat="server">
	Site Creation Workflow settings
</asp:Content>
<asp:content ID="Content4" contentplaceholderid="PlaceHolderPageDescription" runat="server">
Site Creation Workflow settings
</asp:content>
<asp:content ID="Content5" contentplaceholderid="PlaceHolderMain" runat="server">
  <script runat="server">
	  protected override void OnPreRender(EventArgs e)
	  {
		  base.OnPreRender(e);

		  try
		  {
			  WorkflowSettings settings = WorkflowSettings.GetSettings(
				  SPContext.Current.Site.RootWeb.Url
				  );

			  ListName.Text = settings.listName.ToString();
			  EmailEnabled.Checked = settings.enableEmails;
			  scAdminBody.Text = settings.scAdminEmail.ToString();
			  siteCreatorEmail.Text = settings.siteCreatorEmail.ToString();
		  }
		  catch (Exception ex)
		  {
			  Label1.Text = "Error: Could not load current settings: " + ex.Message;
			  Label1.Visible = true;
		  }
	  }
	protected void Button1_Click(object sender, EventArgs e)
	{
		try {
			WorkflowSettings settings = WorkflowSettings.GetSettings(
				  SPContext.Current.Site.RootWeb.Url
				  );
			settings.listName = ListName.Text;
			settings.enableEmails = EmailEnabled.Checked;
			settings.scAdminEmail = scAdminBody.Text;
			settings.siteCreatorEmail = siteCreatorEmail.Text;

			WorkflowSettings.SetSettings(SPContext.Current.Site.RootWeb, settings);
			this.Page.Response.Redirect(SPContext.Current.Web.Url);
		} catch (Exception ex)
		{
			Label1.Text = ex.Message;
			Label1.Visible = true;	
		}
	}
</script>

<strong>
	<asp:Label ID="Label1" runat="server" Font-Bold="True" ForeColor="Red" Text="Label"
		Visible="False"></asp:Label><br />
</strong>

Site Approval Request List Name: 
<asp:TextBox ID="ListName" runat="server" /><br />


Enable email notifications: 
<asp:CheckBox ID="EmailEnabled" runat="server" /><br />

Enter desired text for the Site Collection Administrator notifications:
<asp:TextBox runat="server" TextMode="MultiLine" Rows="15" Columns="70" ID="scAdminBody"></asp:TextBox><br />

Enter desired text for the Site creator notification:
<asp:TextBox runat="server" TextMode="MultiLine" Rows="15" Columns="70" ID="siteCreatorEmail"></asp:TextBox><br />

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Save" />
	
</asp:content>
